const Webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin');
const Path = require('path')
module.exports = {
  entry: [
    './app/index.js'
  ],
  output: {
    filename: '[name].js',
    // publicPath: '/assets/',
    path: Path.resolve(__dirname, 'dist'),
  },
  resolve: {
    alias: {
      bower: Path.resolve(__dirname, 'bower_components'),
      Matter: Path.resolve(__dirname, 'bower_components/Matter/build/matter-dev.js'),
      'matter-js': Path.resolve(__dirname, 'bower_components/Matter/build/matter-dev.js'),
      MatterTools: Path.resolve(__dirname, 'bower_components/matter-tools/index.js'),
      MatterAttractors: Path.resolve(__dirname, 'bower_components/matter-attractors/build/matter-attractors.min.js'),
      jQuery: Path.resolve(__dirname, 'bower_components/jquery/dist/jquery.min.js'),
    }
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        loader: 'babel-loader',
        query: {
          presets: ['es2015'],
          plugins: [
            'transform-class-properties'
          ]
        }
      },
      {
        test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
        loader: 'url-loader',
        // options: {
        //   limit: 1,
        //   name: utils.assetsPath('img/[name].[ext]')
        // }
      }
    ]
  },
  plugins: [
    new HtmlWebpackPlugin({
      filename: 'index.html',
      template: './app/index.html'
    })
  ],
  devServer: {
    inline: true,
    contentBase: './app',
    port: 7777
  }
}